﻿using System;
using NUnit.Framework;
using PropertyExpression.Common;

namespace PropertyExpression.ReactiveRelation.Test
{
    [TestFixture]
    public class OptionalValueTestFixture
    {
        private bool someCondition;

        [Test]
        public void Test()
        {
            IOptionalValue<Type1> outerValue;

            #region Scope1

            if (someCondition)
            {
                var value = SomeMethod();
                outerValue = value.AsOptionalValue();
            }
            else
            {
                outerValue = OptionalValue.Nothing<Type1>();
            }

            #endregion End of Scope1

            #region Scope2

            outerValue.Process(
                value => Console.WriteLine(value.Name),
                () =>
                    {
                        //TODO: implement this
                        throw new NotImplementedException();
                    }
                );

            #endregion End of Scope2
        }

        private Type1 SomeMethod()
        {
            throw new NotImplementedException();
        }

        class Type1
        {
            public string Name
            {
                get { throw new NotImplementedException(); }
            }
        }
    }
}